package com.group.activity.controller;

import java.util.Arrays;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.group.activity.entity.GroupShoprecordEntity;
import com.group.activity.service.GroupShoprecordService;
import com.group.common.utils.PageUtils;
import com.group.common.utils.R;



/**
 * 拼团记录表
 *
 * @author gxx
 * @email hongyezhaofang.com
 * @date 2021-11-16 15:07:25
 */
@RestController
@RequestMapping("acticity/groupshoprecord")
public class GroupShoprecordController {
    @Autowired
    private GroupShoprecordService groupShoprecordService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = groupShoprecordService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{groupId}")
    public R info(@PathVariable("groupId") Integer groupId){
		GroupShoprecordEntity groupShoprecord = groupShoprecordService.getById(groupId);

        return R.ok().put("groupShoprecord", groupShoprecord);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody GroupShoprecordEntity groupShoprecord){
		groupShoprecordService.save(groupShoprecord);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody GroupShoprecordEntity groupShoprecord){
		groupShoprecordService.updateById(groupShoprecord);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Integer[] groupIds){
		groupShoprecordService.removeByIds(Arrays.asList(groupIds));

        return R.ok();
    }

}
